<template>
	<!-- 共享车位 -->
	<view class="content">
		<view class="positioning">
			<view class="left">
				<text>东莞东城区</text>
				<u-icon name="arrow-down-fill" size="16"></u-icon>
			</view>
			<view class="right">
				<u-icon name="question-circle-fill" size="30"></u-icon>
				<text>28°C</text>
			</view>

		</view>
		<view class="search-car">
			<view class="search">
				<u-input v-model="keyword" type="text" placeholder="搜索停车场" />
				<u-icon name="search" size="36" class="search-icon" color="#999999"></u-icon>
			</view>
		</view>
		<view class="makeInformation" >
			<view class="info">
			</view>
			<view>我的车位</view>
			<view class="info1">
			</view>
		</view>
		<view class="parkingSpace" v-for="(item,index) in dataList" :key="index">
			<image :src="item.spaceImage" mode=""></image>
			<view class="center">
				<view class="parking-number">
					{{item.parkingName}}
				</view>
				<view class="map">
					<view class="start-time">
						车位号：{{item.spaceName}}
					</view>
				</view>
				<view class="end-time">
					{{item.statusDesc}}
				</view>
			</view>
			<view class="share">
				<u-button size="mini" type="success" :custom-style="customStyle" >共享</u-button>
			</view>
			
		</view>
		<u-button type="primary" :custom-style="buttonStyle" @click="submitHandler">添加车位</u-button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				keyword: '',
				dataList:[],
				customStyle: {
					padding: '16rpx 12rpx',
					fontSize: '24rpx',
					margin: '0'
				},
				buttonStyle: {
					fontSize: '32rpx',
					borderRadius: '16rpx',
					background: '#1677FE',
					height: '100rpx',
					margin: '100rpx 55rpx 60rpx'
				}
			}
		},
		onLoad() {
			this.getList()
		},
		methods:{
			getList(pages) {
				// 获取openId
				let openId = uni.getStorageSync("userInfo").openid;
				let payload = {
					lastItemTime:'',
					openid: openId
				};
				this.$Api.getShareParkingtList(payload).then((res) => {
					console.log(res)
					// wx.stopPullDownRefresh()
					this.dataList = res.data.dataList;
				});
			},
			submitHandler(){
				uni.navigateTo({
					url:"../../pageB/sharedParking/addParking"
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	@import "index.scss"
</style>